import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.*;

/**
 * Solo se muestra el contador de objetos
 */
public class llave extends Actor
{
    private static final String liveLabel = "objetos recogidos: ";
    private static int obj = 0;
    
    private GreenfootImage box;
    
    public llave() {
        box = new GreenfootImage (205, 60);
        
        box.setColor(new Color (0.5f,0.5f,0f,1f));
        updateStatus (0);
    }
    
    public void act() {
        space w = (space)getWorld();
        obj = w.cont;
        updateStatus (obj);
    }
    
    public void updateStatus (int obj)
    {
        GreenfootImage img = new GreenfootImage (box);
        
        img.setColor (Color.YELLOW);
        img.setFont(new Font("SANS_SERIF", 0, 16));
        img.drawString(liveLabel + obj, 2, 29);
        
        setImage (img);
    }
}